<template>
    <el-icon style = "color:white;" @click="toggleFullscreen">
    <FullScreen></FullScreen>
  </el-icon>
</template>

<script>
import { defineComponent } from 'vue'
import { useFullscreen } from '@vueuse/core'
import { FullScreen } from '@element-plus/icons-vue'

export default defineComponent({
  name: "fullScreen",
  components: {
    FullScreen
  },
  setup() {
    const { isFullscreen, enter, exit } = useFullscreen(document.documentElement)
    function toggleFullscreen() {
      if (isFullscreen.value) {
        exit()
      } else {
        enter()
      }
    }
    return {
      isFullscreen,
      FullScreen,
      toggleFullscreen
    }
  }
})
</script>
